package vcp.gui.guest.screens;

import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.LineBorder;

import java.awt.Color;
import java.awt.GridBagLayout;

import javax.swing.JButton;

import vcp.gui.components.VCPFrame;
import vcp.gui.components.VCPPanel;
import vcp.gui.frames.GuestFrame;

import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.JTextField;

public class ScreenFormWrapper extends VCPPanel {
	private VCPPanel fpanel;

	/**
	 * Create the panel.
	 */
	public ScreenFormWrapper(VCPPanel panel) {
		
		this.fpanel = panel;
		
		JPanel panelMenu = new JPanel();
		panelMenu.setBackground(Color.LIGHT_GRAY);
		panelMenu.setForeground(Color.BLACK);
		panelMenu.setBorder(new LineBorder(new Color(0, 0, 0)));
		
		JPanel panelForm = new JPanel();
		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addComponent(panelMenu, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE)
				.addComponent(panelForm, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE)
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addComponent(panelMenu, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(panelForm, GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE))
		);
		
		
		panelForm.add(fpanel);
		GridBagLayout gbl_panelMenu = new GridBagLayout();
		gbl_panelMenu.columnWidths = new int[]{0, 0, 0, 0};
		gbl_panelMenu.rowHeights = new int[]{0, 0};
		gbl_panelMenu.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panelMenu.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panelMenu.setLayout(gbl_panelMenu);
		
		JButton btnMainScreen = new JButton("<<Back");
		btnMainScreen.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				GuestFrame parent = (GuestFrame)getParentFrame();
				parent.goToMain();
			}
		});
		GridBagConstraints gbc_btnMainScreen = new GridBagConstraints();
		gbc_btnMainScreen.insets = new Insets(0, 0, 0, 5);
		gbc_btnMainScreen.gridx = 0;
		gbc_btnMainScreen.gridy = 0;
		panelMenu.add(btnMainScreen, gbc_btnMainScreen);
		setLayout(groupLayout);
	}
}
